{php include wl_template('common/header');}
<!-- page 容器 -->
<div class="page">
  <!-- 标题栏 -->
  <header class="bar bar-nav">
    <a class="icon icon-me pull-left open-panel"></a>
    <h1 class="title">解绑自身：解绑柜门与{$current_admin['name']}</h1>
  </header>

  <!-- 这里是页面内容区 -->
  <div class="content main" name="main">
    <div class="row no-gutter">
      <div class="col-20" style="text-align:center;">信息ID</div>
      <div class="col-40" style="text-align:center;">设备名称</div>
      <div class="col-20" style="text-align:center;">柜门号</div>
      <div class="col-20" style="text-align:center;"><input type="checkbox" onclick="var ck = this.checked;$(':checkbox').each(function(){this.checked = ck});" />全选</div>
    </div>    
    {loop $current_cabinet $item}
        <div class="row no-gutter">
          <div class="col-20" style="text-align:center;">{$item['info_id']}</div>
          <div class="col-40" style="text-align:center;">{$item['device_name']}</div>
          <div class="col-20" style="text-align:center;">{$item['door']}</div>
          <div class="col-20" style="text-align:center;"><input class="check" type="checkbox" info_id="{$item['info_id']}" device_name="{$item['device_name']}" door="{$item['door']}"/></div>
        </div>        
    {/loop}
    <div class="content-block"><p><a href="#" class="button">解绑自身：解绑所选柜门与{$current_admin['name']}</a></p></div>
    <div class="content-block"><p>注意：由于您的角色是教师，解绑柜门和自身后，与该柜门绑定的课代表也会被解绑</p></div>
  </div>
  

</div>




<script type="text/javascript">
	$(function(){
        $('.button').click(function(){
            var jsonarray = eval('('+"[]"+')');
            var userid = "{php echo $current_admin['id']}";
            var name = "{php echo $current_admin['name']}";
            $('.check').each(function(){
                if($(this).prop("checked")==true){
                    jsonarray.push(  
                        {  
                            "info_id" : $(this).attr('info_id'),  
                            "device_name" : $(this).attr('device_name'),
                            "door" : $(this).attr('door')
                        }  
                    );                     
                }                
            });
            //alert(JSON.stringify(jsonarray));
            $.post("{php echo app_url('unbind/unbindself/door_teacher_button');}", {arr : jsonarray ,name : name ,userid :userid},function(data){
                //alert(data);
                 window.location="{php echo app_url('scangenerate/scan/prompt');}&prompt="+data; 
            });             
        });
                   
	});

</script>

{php include wl_template('common/footer');}
	